Repository navigation
Add cuda-13 build feature; let parent crates select the CUDA major - #9
Merged
Merged
Conversation
cudarc binds exactly one CUDA major version at compile time (the cuBLAS/NVRTC
SONAMEs and generated bindings differ between majors). Previously the `cuda`
feature hard-pinned `cudarc/cuda-11080`, so a downstream crate could not build
fastkmeans-rs for CUDA 13 without vendoring — and on a CUDA-13-only host the
kernels fail to load (`.so.12` SONAMEs are absent / wrong PTX toolchain).
Decouple "enable the CUDA code" from "choose the CUDA major":
* cudarc no longer pins a version feature in its dependency declaration.
* internal `_cuda` feature pulls in cudarc and gates all CUDA code.
* public `cuda` keeps the historical default (CUDA 11.8 / 12.x) — no behaviour
change for existing users.
* new public `cuda-13` selects `cudarc/cuda-13000` for CUDA 13.x hosts.
Enabling both `cuda` and `cuda-13` fails to compile by design (the versions are
mutually exclusive). All library/example/test cfg gates now key off `_cuda`, so
they build under either CUDA major.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
raphaelsty
added a commit
to lightonai/next-plaid
that referenced
this pull request
Jun 16, 2026
* Add `cuda-13` build feature and make `--force-gpu` truly force the GPU
## cuda-13 build option
cudarc binds exactly one CUDA major version at compile time, so a single binary
cannot serve both CUDA 12 and CUDA 13 hosts. Expose the choice as a feature
instead of hard-pinning it:
* `cuda` -> CUDA 11.8 / 12.x (default, unchanged behaviour)
* `cuda-13` -> CUDA 13.x (hosts where only .so.13 libraries exist)
* `_cuda` -> internal gate that compiles the CUDA code; reached via either
public feature (do not enable directly)
cudarc no longer pins a version in its dependency line; `cuda` / `cuda-13`
select it (and the matching `fastkmeans-rs` feature). All `next-plaid` and
`colgrep` `#[cfg(feature = "cuda")]` gates now key off `_cuda` so they compile
under either major. Enabling both `cuda` and `cuda-13` fails by design. Applied
across next-plaid, colgrep and next-plaid-api; requires fastkmeans-rs >= 1.0.7
(companion PR lightonai/fastkmeans-rs#9).
## --force-gpu must not silently fall back to CPU
ORT registers execution providers best-effort: a CUDA EP that fails to
initialize is silently dropped and the session quietly runs on the CPU, so
`--force-gpu` could still encode on the CPU. Mark the CUDA EP
`error_on_failure()` when the GPU is forced, and turn the CUDA-init panic branch
into a hard error under force-gpu instead of returning a CPU builder.
Verified on a CUDA-13 H100 host: `--force-gpu` indexes on CUDA, and hard-errors
(no CPU fallback) when the GPU is hidden.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Lockfile: fastkmeans-rs 1.0.7
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Raphael Sourty <raphael.sourty@lighton.ai>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
cudarcbinds exactly one CUDA major version at compile time — the cuBLAS/NVRTC SONAMEs (.so.12vs.so.13) and generated bindings differ between majors. Today thecudafeature hard-pinscudarc/cuda-11080, so:next-plaid) cannot build fastkmeans-rs for CUDA 13 without vendoring it, and.so.12libraries don't exist, and feeding mismatched libs tripsCUDA_ERROR_UNSUPPORTED_PTX_VERSION.What
Decouple “enable the CUDA code” from “choose the CUDA major”:
cudacuda-13.so.13exists_cudacudarcno longer pins a version feature in its dependency line; the version is selected bycuda/cuda-13.#[cfg(feature = "cuda")]gates now key off_cuda, so they compile under either major.cudaandcuda-13fails to compile by design (mutually exclusive).Validation
cargo buildpasses for: default (no CUDA),--features cuda, and--features cuda-13.--features cuda,cuda-13fails as expected. Runtime-verified on a CUDA-13 H100 host (driver 580.126.09).Release
Version bumped to 1.0.7. This needs to be published to crates.io before
next-plaidcan depend on thecuda-13feature (see companion PR lightonai/next-plaid).🤖 Generated with Claude Code